home *** CD-ROM | disk | FTP | other *** search
- package java.awt;
-
- import java.awt.image.ImageObserver;
- import java.io.Serializable;
-
- class ImageMediaEntry extends MediaEntry implements ImageObserver, Serializable {
- Image image;
- int width;
- int height;
-
- ImageMediaEntry(MediaTracker mt, Image img, int c, int w, int h) {
- super(mt, c);
- this.image = img;
- this.width = w;
- this.height = h;
- }
-
- Object getMedia() {
- return this.image;
- }
-
- int getStatus(boolean doLoad, boolean doVerify) {
- if (doVerify) {
- int flags = super.tracker.target.checkImage(this.image, this.width, this.height, this);
- int s = this.parseflags(flags);
- if (s == 0) {
- if ((super.status & 12) != 0) {
- ((MediaEntry)this).setStatus(2);
- }
- } else if (s != super.status) {
- ((MediaEntry)this).setStatus(s);
- }
- }
-
- return super.getStatus(doLoad, doVerify);
- }
-
- public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h) {
- if (super.cancelled) {
- return false;
- } else {
- int s = this.parseflags(infoflags);
- if (s != 0 && s != super.status) {
- ((MediaEntry)this).setStatus(s);
- }
-
- return (super.status & 1) != 0;
- }
- }
-
- boolean matches(Image img, int w, int h) {
- return this.image == img && this.width == w && this.height == h;
- }
-
- int parseflags(int infoflags) {
- if ((infoflags & 64) != 0) {
- return 4;
- } else if ((infoflags & 128) != 0) {
- return 2;
- } else {
- return (infoflags & 48) != 0 ? 8 : 0;
- }
- }
-
- void startLoad() {
- if (super.tracker.target.prepareImage(this.image, this.width, this.height, this)) {
- ((MediaEntry)this).setStatus(8);
- }
-
- }
- }
-